//
// Created by zxm on 18-10-10.
//

#include <iostream>

#include "tictoc.h"

#define N  100000000

using namespace std;

int main(int argc, char **argv)
{
    tictoc_ms();

    int s = -1;
    double PI;
    for (auto i = 1; i <= N; i = i + 2)
    {
        s = -s;
        PI = PI + (double) s / i;
    }
    PI = PI * 4;

    long time = tictoc_ms();

    cout << "Calculate PI to " << N << " decimal places took: " << time << "ms" << endl;
    cout << "PI is " << PI << endl;

    return 0;
}